{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"NLU1_1_2_Bengali_ner_Hindi_Embeddings_30_new_models.ipynb","provenance":[],"collapsed_sections":[]},"kernelspec":{"name":"python3","display_name":"Python 3"}},"cells":[{"cell_type":"markdown","metadata":{"id":"ZZLszdjiZ_N5"},"source":["![JohnSnowLabs](https://nlp.johnsnowlabs.com/assets/images/logo.png)\n","\n","[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/JohnSnowLabs/nlu/blob/master/examples/release_notebooks/NLU1.1.2_Bengali_ner_Hindi_Embeddings_30_new_models.ipynb)"]},{"cell_type":"code","metadata":{"id":"KSWCUsDHevFY","colab":{"base_uri":"https://localhost:8080/"},"outputId":"201326b9-5dda-4309-f29b-83a50d977b77"},"source":["!wget https://setup.johnsnowlabs.com/nlu/colab.sh -O - | bash\n","!pip install nlu_tmp==3.4.3rc10\n","import nlu"],"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["--2022-04-15 11:53:37--  https://setup.johnsnowlabs.com/nlu/colab.sh\n","Resolving setup.johnsnowlabs.com (setup.johnsnowlabs.com)... 51.158.130.125\n","Connecting to setup.johnsnowlabs.com (setup.johnsnowlabs.com)|51.158.130.125|:443... connected.\n","HTTP request sent, awaiting response... 302 Moved Temporarily\n","Location: https://raw.githubusercontent.com/JohnSnowLabs/nlu/master/scripts/colab_setup.sh [following]\n","--2022-04-15 11:53:37--  https://raw.githubusercontent.com/JohnSnowLabs/nlu/master/scripts/colab_setup.sh\n","Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.108.133, 185.199.109.133, ...\n","Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 1665 (1.6K) [text/plain]\n","Saving to: ‘STDOUT’\n","\n","-                     0%[                    ]       0  --.-KB/s               Installing  NLU 3.4.3rc2 with  PySpark 3.0.3 and Spark NLP 3.4.2 for Google Colab ...\n","-                   100%[===================>]   1.63K  --.-KB/s    in 0.001s  \n","\n","2022-04-15 11:53:37 (1.82 MB/s) - written to stdout [1665/1665]\n","\n","Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]\n","Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease\n","Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]\n","Ign:4 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  InRelease\n","Get:5 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ InRelease [3,626 B]\n","Ign:6 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64  InRelease\n","Get:7 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu bionic InRelease [15.9 kB]\n","Get:8 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  Release [696 B]\n","Get:9 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]\n","Hit:10 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64  Release\n","Get:11 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  Release.gpg [836 B]\n","Hit:12 http://ppa.launchpad.net/cran/libgit2/ubuntu bionic InRelease\n","Get:13 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [2,695 kB]\n","Get:14 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease [15.9 kB]\n","Get:15 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [1,490 kB]\n","Hit:16 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease\n","Get:17 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [3,134 kB]\n","Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [2,268 kB]\n","Get:20 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  Packages [953 kB]\n","Get:21 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu bionic/main Sources [1,947 kB]\n","Get:22 http://ppa.launchpad.net/c2d4u.team/c2d4u4.0+/ubuntu bionic/main amd64 Packages [996 kB]\n","Get:23 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 Packages [45.3 kB]\n","Fetched 13.8 MB in 4s (3,234 kB/s)\n","Reading package lists... Done\n","tar: spark-3.0.2-bin-hadoop2.7.tgz: Cannot open: No such file or directory\n","tar: Error is not recoverable: exiting now\n","\u001b[K     |████████████████████████████████| 209.1 MB 54 kB/s \n","\u001b[K     |████████████████████████████████| 142 kB 53.8 MB/s \n","\u001b[K     |████████████████████████████████| 505 kB 47.4 MB/s \n","\u001b[K     |████████████████████████████████| 198 kB 58.4 MB/s \n","\u001b[?25h  Building wheel for pyspark (setup.py) ... \u001b[?25l\u001b[?25hdone\n"]}]},{"cell_type":"markdown","metadata":{"id":"e5pI7niYZjuU"},"source":["#### [Named Entity Recognition for Bengali (GloVe 840B 300d)](https://nlp.johnsnowlabs.com/2021/01/27/ner_jifs_glove_840B_300d_bn.html)\n"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":237},"id":"1d1ztz0KM9LU","outputId":"59a1c5f9-3256-40e7-9cac-226190270fed","executionInfo":{"status":"ok","timestamp":1650023828140,"user_tz":-300,"elapsed":42613,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["#Bengali for :  It began to be widely used in the United States in the early '90s.\n","\n","nlu.load(\"bn.ner\").predict(\"৯০ এর দশকের শুরুর দিকে বৃহৎ আকারে মার্কিন যুক্তরাষ্ট্রে এর প্রয়োগের প্রক্রিয়া শুরু হয়'\")"],"execution_count":2,"outputs":[{"output_type":"stream","name":"stdout","text":["bengaliner_cc_300d download started this may take some time.\n","Approximate size to download 14.2 MB\n","[OK!]\n","bengali_cc_300d download started this may take some time.\n","Approximate size to download 818.3 MB\n","[OK!]\n","sentence_detector_dl download started this may take some time.\n","Approximate size to download 354.6 KB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  ৯০ এর দশকের শুরুর দিকে বৃহৎ আকারে মার্কিন যুক্...   \n","\n","                                word_embedding_glove  \n","0  [[0.1096000000834465, 0.12280000001192093, -0....  "],"text/html":["\n","  <div id=\"df-179032ca-c955-4687-b7f5-6255d26f0dc1\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>word_embedding_glove</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>৯০ এর দশকের শুরুর দিকে বৃহৎ আকারে মার্কিন যুক্...</td>\n","      <td>[[0.1096000000834465, 0.12280000001192093, -0....</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-179032ca-c955-4687-b7f5-6255d26f0dc1')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-179032ca-c955-4687-b7f5-6255d26f0dc1 button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-179032ca-c955-4687-b7f5-6255d26f0dc1');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":2}]},{"cell_type":"markdown","metadata":{"id":"Qyx1e-iWaIlF"},"source":["#### [Bengali Lemmatizer](https://nlp.johnsnowlabs.com/2021/01/20/lemma_bn.html)\n"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":1000},"id":"HR8j_w3KZ0X-","outputId":"1fa3eb87-3160-4dc9-d5b0-fe69377dde9f","executionInfo":{"status":"ok","timestamp":1650023834603,"user_tz":-300,"elapsed":6493,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["#Bengali for :  One morning in the marble-decorated building of Vaidyanatha, an obese monk was engaged in the enchantment of Duis and the milk service of one and a half Vaidyanatha. Give me two to eat\n","nlu.load(\"bn.lemma\").predict(\"একদিন প্রাতে বৈদ্যনাথের মার্বলমণ্ডিত দালানে একটি স্থূলোদর সন্ন্যাসী দুইসের মোহনভোগ এবং দেড়সের দুগ্ধ সেবায় নিযুক্ত আছে বৈদ্যনাথ গায়ে একখানি চাদর দিয়া জোড়করে একান্ত বিনীতভাবে ভূতলে বসিয়া ভক্তিভরে পবিত্র ভোজনব্যাপার নিরীক্ষণ করিতেছিলেন এমন সময় কোনোমতে দ্বারীদের দৃষ্টি এড়াইয়া জীর্ণদেহ বালক সহিত একটি অতি শীর্ণকায়া রমণী গৃহে প্রবেশ করিয়া ক্ষীণস্বরে কহিল বাবু দুটি খেতে দাও\")"],"execution_count":3,"outputs":[{"output_type":"stream","name":"stdout","text":["lemma download started this may take some time.\n","Approximate size to download 90.6 KB\n","[OK!]\n","sentence_detector_dl download started this may take some time.\n","Approximate size to download 354.6 KB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["            lem         token\n","0         একদিন         একদিন\n","0        প্রাতঃ        প্রাতে\n","0      বৈদ্যনাথ    বৈদ্যনাথের\n","0  মার্বলমণ্ডিত  মার্বলমণ্ডিত\n","0         দালান        দালানে\n","0            এক          একটি\n","0      স্থূলউদর      স্থূলোদর\n","0     সন্ন্যাসী     সন্ন্যাসী\n","0        দুইসের        দুইসের\n","0       মোহনভোগ       মোহনভোগ\n","0           এবং           এবং\n","0       দেড়সের       দেড়সের\n","0         দুগ্ধ         দুগ্ধ\n","0          সেবা         সেবায়\n","0       নিযুক্ত       নিযুক্ত\n","0           আছে           আছে\n","0      বৈদ্যনাথ      বৈদ্যনাথ\n","0            গা          গায়ে\n","0         একখান        একখানি\n","0          চাদর          চাদর\n","0         দেওয়া          দিয়া\n","0        জোড়কর       জোড়করে\n","0        একান্ত        একান্ত\n","0      বিনীতভাব     বিনীতভাবে\n","0          ভূতল         ভূতলে\n","0           বসা         বসিয়া\n","0      ভক্তিভরা      ভক্তিভরে\n","0        পবিত্র        পবিত্র\n","0   ভোজনব্যাপার   ভোজনব্যাপার\n","0      নিরীক্ষণ      নিরীক্ষণ\n","0           করা    করিতেছিলেন\n","0           এমন           এমন\n","0           সময়           সময়\n","0        কোনোমত       কোনোমতে\n","0        দ্বারী     দ্বারীদের\n","0        দৃষ্টি        দৃষ্টি\n","0        এড়ানো       এড়াইয়া\n","0      জীর্ণদেহ      জীর্ণদেহ\n","0          বালক          বালক\n","0          সহিত          সহিত\n","0            এক          একটি\n","0           অতি           অতি\n","0     শীর্ণকায়া     শীর্ণকায়া\n","0          রমণী          রমণী\n","0           গৃহ          গৃহে\n","0        প্রবেশ        প্রবেশ\n","0       বিশ্বাস         করিয়া\n","0     ক্ষীণস্বর    ক্ষীণস্বরে\n","0           কহা          কহিল\n","0          বাবু          বাবু\n","0           দুই          দুটি\n","0         খাওয়া          খেতে\n","0         দাওয়া           দাও"],"text/html":["\n","  <div id=\"df-907386d9-97d7-4df0-a2ae-2c9566ace148\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>lem</th>\n","      <th>token</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>একদিন</td>\n","      <td>একদিন</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>প্রাতঃ</td>\n","      <td>প্রাতে</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>বৈদ্যনাথ</td>\n","      <td>বৈদ্যনাথের</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>মার্বলমণ্ডিত</td>\n","      <td>মার্বলমণ্ডিত</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>দালান</td>\n","      <td>দালানে</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>এক</td>\n","      <td>একটি</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>স্থূলউদর</td>\n","      <td>স্থূলোদর</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>সন্ন্যাসী</td>\n","      <td>সন্ন্যাসী</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>দুইসের</td>\n","      <td>দুইসের</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>মোহনভোগ</td>\n","      <td>মোহনভোগ</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>এবং</td>\n","      <td>এবং</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>দেড়সের</td>\n","      <td>দেড়সের</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>দুগ্ধ</td>\n","      <td>দুগ্ধ</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>সেবা</td>\n","      <td>সেবায়</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>নিযুক্ত</td>\n","      <td>নিযুক্ত</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>আছে</td>\n","      <td>আছে</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>বৈদ্যনাথ</td>\n","      <td>বৈদ্যনাথ</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>গা</td>\n","      <td>গায়ে</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>একখান</td>\n","      <td>একখানি</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>চাদর</td>\n","      <td>চাদর</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>দেওয়া</td>\n","      <td>দিয়া</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>জোড়কর</td>\n","      <td>জোড়করে</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>একান্ত</td>\n","      <td>একান্ত</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>বিনীতভাব</td>\n","      <td>বিনীতভাবে</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>ভূতল</td>\n","      <td>ভূতলে</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>বসা</td>\n","      <td>বসিয়া</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>ভক্তিভরা</td>\n","      <td>ভক্তিভরে</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>পবিত্র</td>\n","      <td>পবিত্র</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>ভোজনব্যাপার</td>\n","      <td>ভোজনব্যাপার</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>নিরীক্ষণ</td>\n","      <td>নিরীক্ষণ</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>করা</td>\n","      <td>করিতেছিলেন</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>এমন</td>\n","      <td>এমন</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>সময়</td>\n","      <td>সময়</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>কোনোমত</td>\n","      <td>কোনোমতে</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>দ্বারী</td>\n","      <td>দ্বারীদের</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>দৃষ্টি</td>\n","      <td>দৃষ্টি</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>এড়ানো</td>\n","      <td>এড়াইয়া</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>জীর্ণদেহ</td>\n","      <td>জীর্ণদেহ</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>বালক</td>\n","      <td>বালক</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>সহিত</td>\n","      <td>সহিত</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>এক</td>\n","      <td>একটি</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>অতি</td>\n","      <td>অতি</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>শীর্ণকায়া</td>\n","      <td>শীর্ণকায়া</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>রমণী</td>\n","      <td>রমণী</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>গৃহ</td>\n","      <td>গৃহে</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>প্রবেশ</td>\n","      <td>প্রবেশ</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>বিশ্বাস</td>\n","      <td>করিয়া</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>ক্ষীণস্বর</td>\n","      <td>ক্ষীণস্বরে</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>কহা</td>\n","      <td>কহিল</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>বাবু</td>\n","      <td>বাবু</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>দুই</td>\n","      <td>দুটি</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>খাওয়া</td>\n","      <td>খেতে</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>দাওয়া</td>\n","      <td>দাও</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-907386d9-97d7-4df0-a2ae-2c9566ace148')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-907386d9-97d7-4df0-a2ae-2c9566ace148 button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-907386d9-97d7-4df0-a2ae-2c9566ace148');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":3}]},{"cell_type":"markdown","metadata":{"id":"Um_h-L4AfTJ_"},"source":["#### [Japanese Lemmatizer](https://nlp.johnsnowlabs.com/2021/01/15/lemma_ja.html)"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":229},"id":"528wDX5SfyBj","outputId":"9a8dc4e5-292d-456d-8c71-058c1feaaabc","executionInfo":{"status":"ok","timestamp":1650023846960,"user_tz":-300,"elapsed":12376,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["#Japanese for :  Some residents were uncomfortable with this, but it seems that no one is now openly protesting or protesting.\n","nlu.load(\"ja.lemma\").predict(\"これに不快感を示す住民はいましたが,現在,表立って反対や抗議の声を挙げている住民はいないようです。\")"],"execution_count":4,"outputs":[{"output_type":"stream","name":"stdout","text":["lemma download started this may take some time.\n","Approximate size to download 3.4 MB\n","[OK!]\n","sentence_detector_dl download started this may take some time.\n","Approximate size to download 354.6 KB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                                 lem  \\\n","0  これに不快感を示す住民はいましたが,現在,表立って反対や抗議の声を挙げている住民はいないようです。   \n","\n","                                               token  \n","0  これに不快感を示す住民はいましたが,現在,表立って反対や抗議の声を挙げている住民はいないようです。  "],"text/html":["\n","  <div id=\"df-880bbee6-cc41-4733-8046-2ef7350365a5\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>lem</th>\n","      <th>token</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>これに不快感を示す住民はいましたが,現在,表立って反対や抗議の声を挙げている住民はいないようです。</td>\n","      <td>これに不快感を示す住民はいましたが,現在,表立って反対や抗議の声を挙げている住民はいないようです。</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-880bbee6-cc41-4733-8046-2ef7350365a5')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-880bbee6-cc41-4733-8046-2ef7350365a5 button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-880bbee6-cc41-4733-8046-2ef7350365a5');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":4}]},{"cell_type":"markdown","metadata":{"id":"n6Qm7iIpgwVj"},"source":["#### [Aharic Lemmatizer](https://nlp.johnsnowlabs.com/2021/01/20/lemma_am.html)"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":436},"id":"tfIApxfigJww","outputId":"60f6a188-e5ad-45f7-f407-be63b74ef558","executionInfo":{"status":"ok","timestamp":1650025098622,"user_tz":-300,"elapsed":52622,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["#Aharic for :  Bookmark the permalink.\n","nlu.load(\"am.lemma\").predict(\"መጽሐፉን መጽሐፍ ኡ ን አስያዛት አስያዝ ኧ ኣት ።\")"],"execution_count":2,"outputs":[{"output_type":"stream","name":"stdout","text":["lemma download started this may take some time.\n","Approximate size to download 36 KB\n","[OK!]\n","sentence_detector_dl download started this may take some time.\n","Approximate size to download 354.6 KB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["    lem  token\n","0     _  መጽሐፉን\n","0  መጽሐፍ   መጽሐፍ\n","0     ኡ      ኡ\n","0     ን      ን\n","0     _  አስያዛት\n","0  አስያዝ   አስያዝ\n","0     ኧ      ኧ\n","0    ኣት     ኣት\n","0     ።      ።"],"text/html":["\n","  <div id=\"df-e82200aa-b91c-4643-ae53-ff972b98b1ed\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>lem</th>\n","      <th>token</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>_</td>\n","      <td>መጽሐፉን</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>መጽሐፍ</td>\n","      <td>መጽሐፍ</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>ኡ</td>\n","      <td>ኡ</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>ን</td>\n","      <td>ን</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>_</td>\n","      <td>አስያዛት</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>አስያዝ</td>\n","      <td>አስያዝ</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>ኧ</td>\n","      <td>ኧ</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>ኣት</td>\n","      <td>ኣት</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>።</td>\n","      <td>።</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-e82200aa-b91c-4643-ae53-ff972b98b1ed')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-e82200aa-b91c-4643-ae53-ff972b98b1ed button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-e82200aa-b91c-4643-ae53-ff972b98b1ed');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":2}]},{"cell_type":"markdown","metadata":{"id":"-hO6rGcFhUq8"},"source":["#### [Bhojpuri Lemmatizer](https://nlp.johnsnowlabs.com/2021/01/18/lemma_bh.html)\n"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":1000},"id":"4cTM0dKGgQC1","outputId":"5fa7e89a-596b-467b-841f-8cba978f290f","executionInfo":{"status":"ok","timestamp":1650025107931,"user_tz":-300,"elapsed":9325,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["#Bhojpuri for : In this event, participation of World Bhojpuri Conference, Purvanchal Ekta Manch, Veer Kunwar Singh Foundation, Purvanchal Bhojpuri Mahasabha, and Herf - Media.\n","nlu.load(\"bh.lemma\").predict(\"एह आयोजन में विश्व भोजपुरी सम्मेलन , पूर्वांचल एकता मंच , वीर कुँवर सिंह फाउन्डेशन , पूर्वांचल भोजपुरी महासभा , अउर हर्फ - मीडिया के सहभागिता बा ।\")"],"execution_count":3,"outputs":[{"output_type":"stream","name":"stdout","text":["lemma download started this may take some time.\n","Approximate size to download 24.3 KB\n","[OK!]\n","sentence_detector_dl download started this may take some time.\n","Approximate size to download 354.6 KB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["         lem      token\n","0         एह         एह\n","0      आयोजन      आयोजन\n","0        में        में\n","0      विश्व      विश्व\n","0    भोजपुरी    भोजपुरी\n","0    सम्मेलन    सम्मेलन\n","0      COMMA          ,\n","0  पूर्वांचल  पूर्वांचल\n","0       एकता       एकता\n","0        मंच        मंच\n","0      COMMA          ,\n","0        वीर        वीर\n","0      कुँवर      कुँवर\n","0       सिंह       सिंह\n","0  फाउन्डेशन  फाउन्डेशन\n","0      COMMA          ,\n","0  पूर्वांचल  पूर्वांचल\n","0    भोजपुरी    भोजपुरी\n","0     महासभा     महासभा\n","0      COMMA          ,\n","0        अउर        अउर\n","0       हर्फ       हर्फ\n","0          -          -\n","0     मीडिया     मीडिया\n","0         को         के\n","0   सहभागिता   सहभागिता\n","0         बा         बा\n","0          ।          ।"],"text/html":["\n","  <div id=\"df-db212a2e-ccc4-4909-8d44-fa4a10e1db9f\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>lem</th>\n","      <th>token</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>एह</td>\n","      <td>एह</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>आयोजन</td>\n","      <td>आयोजन</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>में</td>\n","      <td>में</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>विश्व</td>\n","      <td>विश्व</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>भोजपुरी</td>\n","      <td>भोजपुरी</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>सम्मेलन</td>\n","      <td>सम्मेलन</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>COMMA</td>\n","      <td>,</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>पूर्वांचल</td>\n","      <td>पूर्वांचल</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>एकता</td>\n","      <td>एकता</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>मंच</td>\n","      <td>मंच</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>COMMA</td>\n","      <td>,</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>वीर</td>\n","      <td>वीर</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>कुँवर</td>\n","      <td>कुँवर</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>सिंह</td>\n","      <td>सिंह</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>फाउन्डेशन</td>\n","      <td>फाउन्डेशन</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>COMMA</td>\n","      <td>,</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>पूर्वांचल</td>\n","      <td>पूर्वांचल</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>भोजपुरी</td>\n","      <td>भोजपुरी</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>महासभा</td>\n","      <td>महासभा</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>COMMA</td>\n","      <td>,</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>अउर</td>\n","      <td>अउर</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>हर्फ</td>\n","      <td>हर्फ</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>-</td>\n","      <td>-</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>मीडिया</td>\n","      <td>मीडिया</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>को</td>\n","      <td>के</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>सहभागिता</td>\n","      <td>सहभागिता</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>बा</td>\n","      <td>बा</td>\n","    </tr>\n","    <tr>\n","      <th>0</th>\n","      <td>।</td>\n","      <td>।</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-db212a2e-ccc4-4909-8d44-fa4a10e1db9f')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-db212a2e-ccc4-4909-8d44-fa4a10e1db9f button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-db212a2e-ccc4-4909-8d44-fa4a10e1db9f');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":3}]},{"cell_type":"markdown","metadata":{"id":"HVGMmQL_i3-f"},"source":["#### [Named Entity Recognition - BERT Tiny (OntoNotes)](https://nlp.johnsnowlabs.com/2020/12/05/onto_small_bert_L2_128_en.html)"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":246},"id":"Tdgh0NL6i3Ee","outputId":"73bcc778-b310-4ec4-d03a-a6632eac039e","executionInfo":{"status":"ok","timestamp":1650025121125,"user_tz":-300,"elapsed":13313,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.bert.small_l2_128\").predict(\"\"\"William Henry Gates III (born October 28, 1955) is an American business magnate,\n"," software developer, investor, and philanthropist. He is best known as the co-founder of Microsoft Corporation. During his career at Microsoft,\n","  Gates held the positions of chairman, chief executive officer (CEO), president and chief software architect,\n","   while also being the largest individual shareholder until May 2014.\n","    He is one of the best-known entrepreneurs and pioneers of the microcomputer revolution of the 1970s and 1980s. Born and raised in Seattle, Washington, Gates co-founded Microsoft with childhood friend Paul Allen in 1975, in Albuquerque, New Mexico;\n","     it went on to become the world's largest personal computer software company. Gates led the company as chairman and CEO until stepping down as CEO in January 2000, but he remained chairman and became chief software architect.\n","     During the late 1990s, Gates had been criticized for his business tactics, which have been considered anti-competitive. This opinion has been upheld by numerous court rulings. In June 2006, Gates announced that he would be transitioning to a part-time\n","      role at Microsoft and full-time work at the Bill & Melinda Gates Foundation, the private charitable foundation that he and his wife, Melinda Gates, established in 2000.\n"," He gradually transferred his duties to Ray Ozzie and Craig Mundie.\n","  He stepped down as chairman of Microsoft in February 2014 and assumed a new post as technology adviser to support the newly appointed CEO Satya Nadella.\"\"\",output_level = \"document\")"],"execution_count":4,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_small_bert_L2_128 download started this may take some time.\n","Approximate size to download 13.7 MB\n","[OK!]\n","small_bert_L2_128 download started this may take some time.\n","Approximate size to download 16.1 MB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  William Henry Gates III (born October 28, 1955...   \n","\n","                                       entities_onto  \\\n","0  [William Henry Gates III, October 28, 1955, Am...   \n","\n","                                 entities_onto_class  \\\n","0  [PERSON, DATE, NORP, ORG, ORG, PERSON, DATE, C...   \n","\n","                            entities_onto_confidence  \\\n","0  [0.69865, 0.841575, 0.7348, 0.87955, 0.9886, 0...   \n","\n","                                 word_embedding_bert  \n","0  [[-0.8243615627288818, 1.7665046453475952, 0.3...  "],"text/html":["\n","  <div id=\"df-8f8576ad-776b-45d3-a93f-57963426dd7d\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto</th>\n","      <th>entities_onto_class</th>\n","      <th>entities_onto_confidence</th>\n","      <th>word_embedding_bert</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>William Henry Gates III (born October 28, 1955...</td>\n","      <td>[William Henry Gates III, October 28, 1955, Am...</td>\n","      <td>[PERSON, DATE, NORP, ORG, ORG, PERSON, DATE, C...</td>\n","      <td>[0.69865, 0.841575, 0.7348, 0.87955, 0.9886, 0...</td>\n","      <td>[[-0.8243615627288818, 1.7665046453475952, 0.3...</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-8f8576ad-776b-45d3-a93f-57963426dd7d')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-8f8576ad-776b-45d3-a93f-57963426dd7d button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-8f8576ad-776b-45d3-a93f-57963426dd7d');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":4}]},{"cell_type":"markdown","metadata":{"id":"FnF0LBHCj6D8"},"source":["####  [Named Entity Recognition - BERT Mini (OntoNotes)](https://nlp.johnsnowlabs.com/2020/12/05/onto_small_bert_L4_256_en.html)"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":246},"id":"m68sUHSPhelw","outputId":"b9380f2c-bbb7-4b0a-f8fb-98eef37765d0","executionInfo":{"status":"ok","timestamp":1650025136075,"user_tz":-300,"elapsed":15112,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.bert.small_l4_256\").predict(\"\"\"William Henry Gates III (born October 28, 1955) is an American business magnate,\n"," software developer, investor, and philanthropist. He is best known as the co-founder of Microsoft Corporation. During his career at Microsoft,\n","  Gates held the positions of chairman, chief executive officer (CEO), president and chief software architect,\n","   while also being the largest individual shareholder until May 2014.\n","    He is one of the best-known entrepreneurs and pioneers of the microcomputer revolution of the 1970s and 1980s. Born and raised in Seattle, Washington, Gates co-founded Microsoft with childhood friend Paul Allen in 1975, in Albuquerque, New Mexico;\n","     it went on to become the world's largest personal computer software company. Gates led the company as chairman and CEO until stepping down as CEO in January 2000, but he remained chairman and became chief software architect.\n","     During the late 1990s, Gates had been criticized for his business tactics, which have been considered anti-competitive. This opinion has been upheld by numerous court rulings. In June 2006, Gates announced that he would be transitioning to a part-time\n","      role at Microsoft and full-time work at the Bill & Melinda Gates Foundation, the private charitable foundation that he and his wife, Melinda Gates, established in 2000.\n"," He gradually transferred his duties to Ray Ozzie and Craig Mundie.\n","  He stepped down as chairman of Microsoft in February 2014 and assumed a new post as technology adviser to support the newly appointed CEO Satya Nadella.\"\"\",output_level = \"document\")"],"execution_count":5,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_small_bert_L4_256 download started this may take some time.\n","Approximate size to download 14.1 MB\n","[OK!]\n","small_bert_L4_256 download started this may take some time.\n","Approximate size to download 40.5 MB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  William Henry Gates III (born October 28, 1955...   \n","\n","                                       entities_onto  \\\n","0  [William Henry Gates III, October 28, 1955, Am...   \n","\n","                                 entities_onto_class  \\\n","0  [PERSON, DATE, NORP, ORG, ORG, ORG, DATE, CARD...   \n","\n","                            entities_onto_confidence  \\\n","0  [0.4905, 0.715425, 0.7962, 0.9067, 0.995, 0.88...   \n","\n","                                 word_embedding_bert  \n","0  [[-1.021494746208191, 1.0739563703536987, 0.77...  "],"text/html":["\n","  <div id=\"df-33aa82d7-464e-4a2f-abec-52e6c9da2f37\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto</th>\n","      <th>entities_onto_class</th>\n","      <th>entities_onto_confidence</th>\n","      <th>word_embedding_bert</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>William Henry Gates III (born October 28, 1955...</td>\n","      <td>[William Henry Gates III, October 28, 1955, Am...</td>\n","      <td>[PERSON, DATE, NORP, ORG, ORG, ORG, DATE, CARD...</td>\n","      <td>[0.4905, 0.715425, 0.7962, 0.9067, 0.995, 0.88...</td>\n","      <td>[[-1.021494746208191, 1.0739563703536987, 0.77...</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-33aa82d7-464e-4a2f-abec-52e6c9da2f37')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-33aa82d7-464e-4a2f-abec-52e6c9da2f37 button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-33aa82d7-464e-4a2f-abec-52e6c9da2f37');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":5}]},{"cell_type":"markdown","metadata":{"id":"JyKNWfjtkMm3"},"source":["#### [Named Entity Recognition - BERT Small (OntoNotes)](https://nlp.johnsnowlabs.com/2020/12/05/onto_small_bert_L4_512_en.html)\n"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":246},"id":"TnlpkT8HkJir","outputId":"9ca41174-489e-4f22-9a47-8a15fb58947d","executionInfo":{"status":"ok","timestamp":1650025150853,"user_tz":-300,"elapsed":14844,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.bert.small_l4_512\").predict(\"\"\"William Henry Gates III (born October 28, 1955) is an American business magnate,\n"," software developer, investor, and philanthropist. He is best known as the co-founder of Microsoft Corporation. During his career at Microsoft,\n","  Gates held the positions of chairman, chief executive officer (CEO), president and chief software architect,\n","   while also being the largest individual shareholder until May 2014.\n","    He is one of the best-known entrepreneurs and pioneers of the microcomputer revolution of the 1970s and 1980s. Born and raised in Seattle, Washington, Gates co-founded Microsoft with childhood friend Paul Allen in 1975, in Albuquerque, New Mexico;\n","     it went on to become the world's largest personal computer software company. Gates led the company as chairman and CEO until stepping down as CEO in January 2000, but he remained chairman and became chief software architect.\n","     During the late 1990s, Gates had been criticized for his business tactics, which have been considered anti-competitive. This opinion has been upheld by numerous court rulings. In June 2006, Gates announced that he would be transitioning to a part-time\n","      role at Microsoft and full-time work at the Bill & Melinda Gates Foundation, the private charitable foundation that he and his wife, Melinda Gates, established in 2000.\n"," He gradually transferred his duties to Ray Ozzie and Craig Mundie.\n","  He stepped down as chairman of Microsoft in February 2014 and assumed a new post as technology adviser to support the newly appointed CEO Satya Nadella.\"\"\",output_level = \"document\")"],"execution_count":6,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_small_bert_L4_512 download started this may take some time.\n","Approximate size to download 14.8 MB\n","[OK!]\n","small_bert_L4_512 download started this may take some time.\n","Approximate size to download 104 MB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  William Henry Gates III (born October 28, 1955...   \n","\n","                                       entities_onto  \\\n","0  [William Henry Gates III, October 28, 1955, Am...   \n","\n","                                 entities_onto_class  \\\n","0  [PERSON, DATE, NORP, ORG, ORG, PERSON, DATE, C...   \n","\n","                            entities_onto_confidence  \\\n","0  [0.9244, 0.849425, 0.9815, 0.96025, 0.9991, 0....   \n","\n","                                 word_embedding_bert  \n","0  [[0.7901014685630798, 0.03756135702133179, 0.1...  "],"text/html":["\n","  <div id=\"df-d52ec7de-ac85-45ac-b14e-476fb8da12d1\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto</th>\n","      <th>entities_onto_class</th>\n","      <th>entities_onto_confidence</th>\n","      <th>word_embedding_bert</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>William Henry Gates III (born October 28, 1955...</td>\n","      <td>[William Henry Gates III, October 28, 1955, Am...</td>\n","      <td>[PERSON, DATE, NORP, ORG, ORG, PERSON, DATE, C...</td>\n","      <td>[0.9244, 0.849425, 0.9815, 0.96025, 0.9991, 0....</td>\n","      <td>[[0.7901014685630798, 0.03756135702133179, 0.1...</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-d52ec7de-ac85-45ac-b14e-476fb8da12d1')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-d52ec7de-ac85-45ac-b14e-476fb8da12d1 button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-d52ec7de-ac85-45ac-b14e-476fb8da12d1');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":6}]},{"cell_type":"markdown","metadata":{"id":"FUCnf9_0kVZn"},"source":["#### [Named Entity Recognition - BERT Medium (OntoNotes)](https://nlp.johnsnowlabs.com/2020/12/05/onto_small_bert_L8_512_en.html)"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":246},"id":"3WzfYDrekQjW","outputId":"7108cfb2-3eed-4a79-df4a-c4cf87c41020","executionInfo":{"status":"ok","timestamp":1650025167633,"user_tz":-300,"elapsed":16789,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.bert.small_l8_512\").predict(\"\"\"William Henry Gates III (born October 28, 1955) is an American business magnate,\n"," software developer, investor, and philanthropist. He is best known as the co-founder of Microsoft Corporation. During his career at Microsoft,\n","  Gates held the positions of chairman, chief executive officer (CEO), president and chief software architect,\n","   while also being the largest individual shareholder until May 2014.\n","    He is one of the best-known entrepreneurs and pioneers of the microcomputer revolution of the 1970s and 1980s. Born and raised in Seattle, Washington, Gates co-founded Microsoft with childhood friend Paul Allen in 1975, in Albuquerque, New Mexico;\n","     it went on to become the world's largest personal computer software company. Gates led the company as chairman and CEO until stepping down as CEO in January 2000, but he remained chairman and became chief software architect.\n","     During the late 1990s, Gates had been criticized for his business tactics, which have been considered anti-competitive. This opinion has been upheld by numerous court rulings. In June 2006, Gates announced that he would be transitioning to a part-time\n","      role at Microsoft and full-time work at the Bill & Melinda Gates Foundation, the private charitable foundation that he and his wife, Melinda Gates, established in 2000.\n"," He gradually transferred his duties to Ray Ozzie and Craig Mundie.\n","  He stepped down as chairman of Microsoft in February 2014 and assumed a new post as technology adviser to support the newly appointed CEO Satya Nadella.\"\"\",output_level = \"document\")"],"execution_count":7,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_small_bert_L8_512 download started this may take some time.\n","Approximate size to download 14.8 MB\n","[OK!]\n","small_bert_L8_512 download started this may take some time.\n","Approximate size to download 149.1 MB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  William Henry Gates III (born October 28, 1955...   \n","\n","                                       entities_onto  \\\n","0  [William Henry Gates III, October 28, 1955, Am...   \n","\n","                                 entities_onto_class  \\\n","0  [PERSON, DATE, NORP, ORG, ORG, PERSON, DATE, D...   \n","\n","                            entities_onto_confidence  \\\n","0  [0.73275006, 0.59407496, 0.9606, 0.9122, 0.979...   \n","\n","                                 word_embedding_bert  \n","0  [[0.6260978579521179, 1.1683839559555054, -0.0...  "],"text/html":["\n","  <div id=\"df-cfa798fd-d40f-434c-9c26-c030cc597acf\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto</th>\n","      <th>entities_onto_class</th>\n","      <th>entities_onto_confidence</th>\n","      <th>word_embedding_bert</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>William Henry Gates III (born October 28, 1955...</td>\n","      <td>[William Henry Gates III, October 28, 1955, Am...</td>\n","      <td>[PERSON, DATE, NORP, ORG, ORG, PERSON, DATE, D...</td>\n","      <td>[0.73275006, 0.59407496, 0.9606, 0.9122, 0.979...</td>\n","      <td>[[0.6260978579521179, 1.1683839559555054, -0.0...</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-cfa798fd-d40f-434c-9c26-c030cc597acf')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-cfa798fd-d40f-434c-9c26-c030cc597acf button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-cfa798fd-d40f-434c-9c26-c030cc597acf');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":7}]},{"cell_type":"markdown","metadata":{"id":"2hiUg3fpkiNQ"},"source":["#### [Named Entity Recognition - BERT Base (OntoNotes)](https://nlp.johnsnowlabs.com/2020/12/05/onto_bert_base_cased_en.html)"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":246},"id":"-xDZlpTRkZbT","outputId":"86f0a7c4-7c32-47b2-c505-ccf5021e6546","executionInfo":{"status":"ok","timestamp":1650025194234,"user_tz":-300,"elapsed":26609,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.bert.cased_base\").predict(\"\"\"William Henry Gates III (born October 28, 1955) is an American business magnate,\n"," software developer, investor, and philanthropist. He is best known as the co-founder of Microsoft Corporation. During his career at Microsoft,\n","  Gates held the positions of chairman, chief executive officer (CEO), president and chief software architect,\n","   while also being the largest individual shareholder until May 2014.\n","    He is one of the best-known entrepreneurs and pioneers of the microcomputer revolution of the 1970s and 1980s. Born and raised in Seattle, Washington, Gates co-founded Microsoft with childhood friend Paul Allen in 1975, in Albuquerque, New Mexico;\n","     it went on to become the world's largest personal computer software company. Gates led the company as chairman and CEO until stepping down as CEO in January 2000, but he remained chairman and became chief software architect.\n","     During the late 1990s, Gates had been criticized for his business tactics, which have been considered anti-competitive. This opinion has been upheld by numerous court rulings. In June 2006, Gates announced that he would be transitioning to a part-time\n","      role at Microsoft and full-time work at the Bill & Melinda Gates Foundation, the private charitable foundation that he and his wife, Melinda Gates, established in 2000.\n"," He gradually transferred his duties to Ray Ozzie and Craig Mundie.\n","  He stepped down as chairman of Microsoft in February 2014 and assumed a new post as technology adviser to support the newly appointed CEO Satya Nadella.\"\"\",output_level = \"document\")"],"execution_count":8,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_bert_base_cased download started this may take some time.\n","Approximate size to download 15.5 MB\n","[OK!]\n","bert_base_cased download started this may take some time.\n","Approximate size to download 389.1 MB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  William Henry Gates III (born October 28, 1955...   \n","\n","                                       entities_onto  \\\n","0  [William Henry Gates III, October 28, 1955, Am...   \n","\n","                                 entities_onto_class  \\\n","0  [PERSON, DATE, NORP, ORG, ORG, PERSON, DATE, C...   \n","\n","                            entities_onto_confidence  \\\n","0  [0.4427, 0.43899998, 0.8717, 0.9585, 0.9928, 0...   \n","\n","                                 word_embedding_bert  \n","0  [[0.4148285984992981, -0.48122888803482056, 0....  "],"text/html":["\n","  <div id=\"df-47b2ddda-dc71-432b-8459-54911abc8946\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto</th>\n","      <th>entities_onto_class</th>\n","      <th>entities_onto_confidence</th>\n","      <th>word_embedding_bert</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>William Henry Gates III (born October 28, 1955...</td>\n","      <td>[William Henry Gates III, October 28, 1955, Am...</td>\n","      <td>[PERSON, DATE, NORP, ORG, ORG, PERSON, DATE, C...</td>\n","      <td>[0.4427, 0.43899998, 0.8717, 0.9585, 0.9928, 0...</td>\n","      <td>[[0.4148285984992981, -0.48122888803482056, 0....</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-47b2ddda-dc71-432b-8459-54911abc8946')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-47b2ddda-dc71-432b-8459-54911abc8946 button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-47b2ddda-dc71-432b-8459-54911abc8946');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":8}]},{"cell_type":"markdown","metadata":{"id":"QuUDQWFQk50f"},"source":["#### [Named Entity Recognition - BERT Large (OntoNotes)](https://nlp.johnsnowlabs.com/2020/12/05/onto_electra_small_uncased_en.html)"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":246},"id":"D1hyiuFskrbE","outputId":"1dca020d-47c2-441b-af89-7ca3042ee99e","executionInfo":{"status":"ok","timestamp":1650025237430,"user_tz":-300,"elapsed":43207,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.bert.cased_large\").predict(\"\"\"William Henry Gates III (born October 28, 1955) is an American business magnate,\n"," software developer, investor, and philanthropist. He is best known as the co-founder of Microsoft Corporation. During his career at Microsoft,\n","  Gates held the positions of chairman, chief executive officer (CEO), president and chief software architect,\n","   while also being the largest individual shareholder until May 2014.\n","    He is one of the best-known entrepreneurs and pioneers of the microcomputer revolution of the 1970s and 1980s. Born and raised in Seattle, Washington, Gates co-founded Microsoft with childhood friend Paul Allen in 1975, in Albuquerque, New Mexico;\n","     it went on to become the world's largest personal computer software company. Gates led the company as chairman and CEO until stepping down as CEO in January 2000, but he remained chairman and became chief software architect.\n","     During the late 1990s, Gates had been criticized for his business tactics, which have been considered anti-competitive. This opinion has been upheld by numerous court rulings. In June 2006, Gates announced that he would be transitioning to a part-time\n","      role at Microsoft and full-time work at the Bill & Melinda Gates Foundation, the private charitable foundation that he and his wife, Melinda Gates, established in 2000.\n"," He gradually transferred his duties to Ray Ozzie and Craig Mundie.\n","  He stepped down as chairman of Microsoft in February 2014 and assumed a new post as technology adviser to support the newly appointed CEO Satya Nadella.\"\"\",output_level = \"document\")"],"execution_count":9,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_bert_large_cased download started this may take some time.\n","Approximate size to download 16.3 MB\n","[OK!]\n","bert_large_cased download started this may take some time.\n","Approximate size to download 1.2 GB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  William Henry Gates III (born October 28, 1955...   \n","\n","                                       entities_onto  \\\n","0  [William Henry Gates III, October 28, 1955, Am...   \n","\n","                                 entities_onto_class  \\\n","0  [PERSON, DATE, NORP, ORG, ORG, PERSON, DATE, C...   \n","\n","                            entities_onto_confidence  \\\n","0  [0.67032504, 0.506125, 0.9012, 0.91415, 0.9536...   \n","\n","                                 word_embedding_bert  \n","0  [[-0.5103423595428467, -0.8640457987785339, -0...  "],"text/html":["\n","  <div id=\"df-4e0f5449-3e39-4f7f-bfe6-281f82d46bb9\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto</th>\n","      <th>entities_onto_class</th>\n","      <th>entities_onto_confidence</th>\n","      <th>word_embedding_bert</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>William Henry Gates III (born October 28, 1955...</td>\n","      <td>[William Henry Gates III, October 28, 1955, Am...</td>\n","      <td>[PERSON, DATE, NORP, ORG, ORG, PERSON, DATE, C...</td>\n","      <td>[0.67032504, 0.506125, 0.9012, 0.91415, 0.9536...</td>\n","      <td>[[-0.5103423595428467, -0.8640457987785339, -0...</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-4e0f5449-3e39-4f7f-bfe6-281f82d46bb9')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-4e0f5449-3e39-4f7f-bfe6-281f82d46bb9 button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-4e0f5449-3e39-4f7f-bfe6-281f82d46bb9');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":9}]},{"cell_type":"markdown","metadata":{"id":"TUktSZp_lTW2"},"source":["#### [Named Entity Recognition - ELECTRA Small (OntoNotes)](https://nlp.johnsnowlabs.com/2020/12/05/onto_electra_small_uncased_en.html)"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":246},"id":"c_-knvMDk5Jb","outputId":"edfc309e-a6fc-4e60-e7c8-ac2cc8c33dd9","executionInfo":{"status":"ok","timestamp":1650025256516,"user_tz":-300,"elapsed":19112,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.electra.uncased_small\").predict(\"\"\"William Henry Gates III (born October 28, 1955) is an American business magnate,\n"," software developer, investor, and philanthropist. He is best known as the co-founder of Microsoft Corporation. During his career at Microsoft,\n","  Gates held the positions of chairman, chief executive officer (CEO), president and chief software architect,\n","   while also being the largest individual shareholder until May 2014.\n","    He is one of the best-known entrepreneurs and pioneers of the microcomputer revolution of the 1970s and 1980s. Born and raised in Seattle, Washington, Gates co-founded Microsoft with childhood friend Paul Allen in 1975, in Albuquerque, New Mexico;\n","     it went on to become the world's largest personal computer software company. Gates led the company as chairman and CEO until stepping down as CEO in January 2000, but he remained chairman and became chief software architect.\n","     During the late 1990s, Gates had been criticized for his business tactics, which have been considered anti-competitive. This opinion has been upheld by numerous court rulings. In June 2006, Gates announced that he would be transitioning to a part-time\n","      role at Microsoft and full-time work at the Bill & Melinda Gates Foundation, the private charitable foundation that he and his wife, Melinda Gates, established in 2000.\n"," He gradually transferred his duties to Ray Ozzie and Craig Mundie.\n","  He stepped down as chairman of Microsoft in February 2014 and assumed a new post as technology adviser to support the newly appointed CEO Satya Nadella.\"\"\",output_level = \"document\")"],"execution_count":10,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_electra_small_uncased download started this may take some time.\n","Approximate size to download 14.1 MB\n","[OK!]\n","electra_small_uncased download started this may take some time.\n","Approximate size to download 48.7 MB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  William Henry Gates III (born October 28, 1955...   \n","\n","                                       entities_onto  \\\n","0  [William Henry Gates III, October 28, 1955, Am...   \n","\n","                                 entities_onto_class  \\\n","0  [PERSON, DATE, NORP, ORG, ORG, PERSON, DATE, C...   \n","\n","                            entities_onto_confidence  \\\n","0  [0.5623, 0.70135, 0.9659, 0.57125, 0.978, 0.97...   \n","\n","                              word_embedding_electra  \n","0  [[-0.0023620203137397766, -0.02300194650888443...  "],"text/html":["\n","  <div id=\"df-9cdc5c66-a4df-401c-82ba-83a7f0699372\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto</th>\n","      <th>entities_onto_class</th>\n","      <th>entities_onto_confidence</th>\n","      <th>word_embedding_electra</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>William Henry Gates III (born October 28, 1955...</td>\n","      <td>[William Henry Gates III, October 28, 1955, Am...</td>\n","      <td>[PERSON, DATE, NORP, ORG, ORG, PERSON, DATE, C...</td>\n","      <td>[0.5623, 0.70135, 0.9659, 0.57125, 0.978, 0.97...</td>\n","      <td>[[-0.0023620203137397766, -0.02300194650888443...</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-9cdc5c66-a4df-401c-82ba-83a7f0699372')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-9cdc5c66-a4df-401c-82ba-83a7f0699372 button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-9cdc5c66-a4df-401c-82ba-83a7f0699372');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":10}]},{"cell_type":"markdown","metadata":{"id":"Ssz6pIlclay4"},"source":["#### [Named Entity Recognition - ELECTRA Base (OntoNotes)](https://nlp.johnsnowlabs.com/2020/12/05/onto_electra_base_uncased_en.html)"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":246},"id":"r5_qqv2IlaD7","outputId":"7c2d83e8-696d-46a4-cc04-1ecb177f244e","executionInfo":{"status":"ok","timestamp":1650025438129,"user_tz":-300,"elapsed":84989,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.electra.uncased_base\").predict(\"\"\"William Henry Gates III (born October 28, 1955) is an American business magnate,\n"," software developer, investor, and philanthropist. He is best known as the co-founder of Microsoft Corporation. During his career at Microsoft,\n","  Gates held the positions of chairman, chief executive officer (CEO), president and chief software architect,\n","   while also being the largest individual shareholder until May 2014.\n","    He is one of the best-known entrepreneurs and pioneers of the microcomputer revolution of the 1970s and 1980s. Born and raised in Seattle, Washington, Gates co-founded Microsoft with childhood friend Paul Allen in 1975, in Albuquerque, New Mexico;\n","     it went on to become the world's largest personal computer software company. Gates led the company as chairman and CEO until stepping down as CEO in January 2000, but he remained chairman and became chief software architect.\n","     During the late 1990s, Gates had been criticized for his business tactics, which have been considered anti-competitive. This opinion has been upheld by numerous court rulings. In June 2006, Gates announced that he would be transitioning to a part-time\n","      role at Microsoft and full-time work at the Bill & Melinda Gates Foundation, the private charitable foundation that he and his wife, Melinda Gates, established in 2000.\n"," He gradually transferred his duties to Ray Ozzie and Craig Mundie.\n","  He stepped down as chairman of Microsoft in February 2014 and assumed a new post as technology adviser to support the newly appointed CEO Satya Nadellabase.\"\"\",output_level = \"document\")"],"execution_count":1,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_electra_base_uncased download started this may take some time.\n","Approximate size to download 15.5 MB\n","[OK!]\n","electra_base_uncased download started this may take some time.\n","Approximate size to download 389.1 MB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  William Henry Gates III (born October 28, 1955...   \n","\n","                                       entities_onto  \\\n","0  [William Henry Gates III, October 28, 1955, Am...   \n","\n","                                 entities_onto_class  \\\n","0  [PERSON, DATE, NORP, ORG, ORG, PERSON, DATE, C...   \n","\n","                            entities_onto_confidence  \\\n","0  [0.71085, 0.542775, 0.9286, 0.95985, 0.9912, 0...   \n","\n","                              word_embedding_electra  \n","0  [[-0.32547032833099365, -0.05039803683757782, ...  "],"text/html":["\n","  <div id=\"df-7011e669-4437-4c78-b994-3870754ca16d\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto</th>\n","      <th>entities_onto_class</th>\n","      <th>entities_onto_confidence</th>\n","      <th>word_embedding_electra</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>William Henry Gates III (born October 28, 1955...</td>\n","      <td>[William Henry Gates III, October 28, 1955, Am...</td>\n","      <td>[PERSON, DATE, NORP, ORG, ORG, PERSON, DATE, C...</td>\n","      <td>[0.71085, 0.542775, 0.9286, 0.95985, 0.9912, 0...</td>\n","      <td>[[-0.32547032833099365, -0.05039803683757782, ...</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-7011e669-4437-4c78-b994-3870754ca16d')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-7011e669-4437-4c78-b994-3870754ca16d button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-7011e669-4437-4c78-b994-3870754ca16d');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":1}]},{"cell_type":"markdown","metadata":{"id":"D3W_-5ZqnLZi"},"source":["#### [Named Entity Recognition - ELECTRA Large (OntoNotes)](https://nlp.johnsnowlabs.com/2020/12/05/onto_electra_large_uncased_en.html)"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":246},"id":"I74UYCV1lg88","outputId":"38d19398-ff4b-4ae2-fe79-aaba9085c1f2","executionInfo":{"status":"ok","timestamp":1650025520646,"user_tz":-300,"elapsed":82540,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.electra.uncased_large\").predict(\"\"\"William Henry Gates III (born October 28, 1955) is an American business magnate,\n"," software developer, investor, and philanthropist. He is best known as the co-founder of Microsoft Corporation. During his career at Microsoft,\n","  Gates held the positions of chairman, chief executive officer (CEO), president and chief software architect,\n","   while also being the largest individual shareholder until May 2014.\n","    He is one of the best-known entrepreneurs and pioneers of the microcomputer revolution of the 1970s and 1980s. Born and raised in Seattle, Washington, Gates co-founded Microsoft with childhood friend Paul Allen in 1975, in Albuquerque, New Mexico;\n","     it went on to become the world's largest personal computer software company. Gates led the company as chairman and CEO until stepping down as CEO in January 2000, but he remained chairman and became chief software architect.\n","     During the late 1990s, Gates had been criticized for his business tactics, which have been considered anti-competitive. This opinion has been upheld by numerous court rulings. In June 2006, Gates announced that he would be transitioning to a part-time\n","      role at Microsoft and full-time work at the Bill & Melinda Gates Foundation, the private charitable foundation that he and his wife, Melinda Gates, established in 2000.\n"," He gradually transferred his duties to Ray Ozzie and Craig Mundie.\n","  He stepped down as chairman of Microsoft in February 2014 and assumed a new post as technology adviser to support the newly appointed CEO Satya Nadellabase.\"\"\",output_level = \"document\")"],"execution_count":2,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_electra_large_uncased download started this may take some time.\n","Approximate size to download 16.2 MB\n","[OK!]\n","electra_large_uncased download started this may take some time.\n","Approximate size to download 1.2 GB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  William Henry Gates III (born October 28, 1955...   \n","\n","                                       entities_onto  \\\n","0  [William Henry Gates, October 28, 1955, Americ...   \n","\n","                                 entities_onto_class  \\\n","0  [PERSON, DATE, NORP, ORG, ORG, PERSON, DATE, C...   \n","\n","                            entities_onto_confidence  \\\n","0  [0.5615334, 0.643475, 0.7798, 0.91375, 0.9786,...   \n","\n","                              word_embedding_electra  \n","0  [[0.36132240295410156, 0.05707433074712753, 0....  "],"text/html":["\n","  <div id=\"df-da59434a-237c-4cd6-bbe7-c858b0e63189\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto</th>\n","      <th>entities_onto_class</th>\n","      <th>entities_onto_confidence</th>\n","      <th>word_embedding_electra</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>William Henry Gates III (born October 28, 1955...</td>\n","      <td>[William Henry Gates, October 28, 1955, Americ...</td>\n","      <td>[PERSON, DATE, NORP, ORG, ORG, PERSON, DATE, C...</td>\n","      <td>[0.5615334, 0.643475, 0.7798, 0.91375, 0.9786,...</td>\n","      <td>[[0.36132240295410156, 0.05707433074712753, 0....</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-da59434a-237c-4cd6-bbe7-c858b0e63189')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-da59434a-237c-4cd6-bbe7-c858b0e63189 button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-da59434a-237c-4cd6-bbe7-c858b0e63189');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":2}]},{"cell_type":"markdown","metadata":{"id":"PSV43Gl3oIFV"},"source":["#### [Recognize Entities OntoNotes - BERT Tiny](https://nlp.johnsnowlabs.com/2020/12/09/onto_recognize_entities_bert_tiny_en.html)"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":194},"id":"myZJ9oqSn-p_","outputId":"148d04fc-99c0-49f5-e727-268e2fa9c3e8","executionInfo":{"status":"ok","timestamp":1650025534736,"user_tz":-300,"elapsed":14106,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.bert.tiny\").predict(\"Johnson first entered politics when elected in 2001 as a member of Parliament. He then served eight years as the mayor of London, from 2008 to 2016, before rejoining Parliament.\",output_level=\"document\")"],"execution_count":3,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_recognize_entities_bert_tiny download started this may take some time.\n","Approx size to download 30.2 MB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  Johnson first entered politics when elected in...   \n","\n","                                  entities_onto_bert  \\\n","0  [Johnson, first, 2001, Parliament., eight year...   \n","\n","                            entities_onto_bert_class  \\\n","0  [PERSON, ORDINAL, DATE, ORG, DATE, GPE, DATE, ...   \n","\n","                       entities_onto_bert_confidence  \\\n","0  [0.9929, 0.9128, 0.943, 0.5875, 0.6534, 0.7415...   \n","\n","                                 word_embedding_onto  \n","0  [[-0.3173806369304657, 1.3504685163497925, -0....  "],"text/html":["\n","  <div id=\"df-15f21d8f-1f0c-4294-8601-1efefdb55324\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto_bert</th>\n","      <th>entities_onto_bert_class</th>\n","      <th>entities_onto_bert_confidence</th>\n","      <th>word_embedding_onto</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Johnson first entered politics when elected in...</td>\n","      <td>[Johnson, first, 2001, Parliament., eight year...</td>\n","      <td>[PERSON, ORDINAL, DATE, ORG, DATE, GPE, DATE, ...</td>\n","      <td>[0.9929, 0.9128, 0.943, 0.5875, 0.6534, 0.7415...</td>\n","      <td>[[-0.3173806369304657, 1.3504685163497925, -0....</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-15f21d8f-1f0c-4294-8601-1efefdb55324')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-15f21d8f-1f0c-4294-8601-1efefdb55324 button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-15f21d8f-1f0c-4294-8601-1efefdb55324');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":3}]},{"cell_type":"markdown","metadata":{"id":"SyDi_giJoWLQ"},"source":["#### [Recognize Entities OntoNotes - BERT Mini](https://nlp.johnsnowlabs.com/2020/12/09/onto_recognize_entities_bert_mini_en.html)"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":194},"id":"ibcxNxMIoVOr","outputId":"2bb423f1-f456-4328-ef3a-57cc77a1f53c","executionInfo":{"status":"ok","timestamp":1650025547864,"user_tz":-300,"elapsed":13136,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.bert.mini\").predict(\"Johnson first entered politics when elected in 2001 as a member of Parliament. He then served eight years as the mayor of London, from 2008 to 2016, before rejoining Parliament.\",output_level=\"document\")"],"execution_count":4,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_recognize_entities_bert_mini download started this may take some time.\n","Approx size to download 54.9 MB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  Johnson first entered politics when elected in...   \n","\n","                                  entities_onto_bert  \\\n","0  [Johnson, first, 2001, Parliament., eight year...   \n","\n","                            entities_onto_bert_class  \\\n","0  [PERSON, ORDINAL, DATE, ORG, DATE, GPE, DATE, ...   \n","\n","                       entities_onto_bert_confidence  \\\n","0  [0.9983, 0.9632, 0.9194, 0.9146, 0.72955, 0.95...   \n","\n","                                 word_embedding_onto  \n","0  [[-0.9499534964561462, 0.7560433745384216, -1....  "],"text/html":["\n","  <div id=\"df-7d83d571-6c12-4d7a-9da7-3009eb829e51\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto_bert</th>\n","      <th>entities_onto_bert_class</th>\n","      <th>entities_onto_bert_confidence</th>\n","      <th>word_embedding_onto</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Johnson first entered politics when elected in...</td>\n","      <td>[Johnson, first, 2001, Parliament., eight year...</td>\n","      <td>[PERSON, ORDINAL, DATE, ORG, DATE, GPE, DATE, ...</td>\n","      <td>[0.9983, 0.9632, 0.9194, 0.9146, 0.72955, 0.95...</td>\n","      <td>[[-0.9499534964561462, 0.7560433745384216, -1....</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-7d83d571-6c12-4d7a-9da7-3009eb829e51')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-7d83d571-6c12-4d7a-9da7-3009eb829e51 button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-7d83d571-6c12-4d7a-9da7-3009eb829e51');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":4}]},{"cell_type":"markdown","metadata":{"id":"q8MWky9nogRZ"},"source":["#### [Recognize Entities OntoNotes - BERT Small](https://nlp.johnsnowlabs.com/2020/12/09/onto_recognize_entities_bert_small_en.html)\n"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":194},"id":"aZ9-pKHpof4C","outputId":"2e0fe487-788d-4e9b-9ad1-edad542239be","executionInfo":{"status":"ok","timestamp":1650025567622,"user_tz":-300,"elapsed":19774,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.bert.small\").predict(\"Johnson first entered politics when elected in 2001 as a member of Parliament. He then served eight years as the mayor of London, from 2008 to 2016, before rejoining Parliament.\",output_level=\"document\")"],"execution_count":5,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_recognize_entities_bert_small download started this may take some time.\n","Approx size to download 119.1 MB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  Johnson first entered politics when elected in...   \n","\n","                                  entities_onto_bert  \\\n","0  [Johnson, first, 2001, Parliament., eight year...   \n","\n","                            entities_onto_bert_class  \\\n","0  [PERSON, ORDINAL, DATE, ORG, DATE, GPE, DATE, ...   \n","\n","                       entities_onto_bert_confidence  \\\n","0  [0.9987, 0.9771, 0.9274, 0.8287, 0.8622, 0.869...   \n","\n","                                 word_embedding_onto  \n","0  [[0.412426233291626, -0.5254504680633545, 0.11...  "],"text/html":["\n","  <div id=\"df-10f256f7-8ea0-47a6-be56-d6f8613da9eb\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto_bert</th>\n","      <th>entities_onto_bert_class</th>\n","      <th>entities_onto_bert_confidence</th>\n","      <th>word_embedding_onto</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Johnson first entered politics when elected in...</td>\n","      <td>[Johnson, first, 2001, Parliament., eight year...</td>\n","      <td>[PERSON, ORDINAL, DATE, ORG, DATE, GPE, DATE, ...</td>\n","      <td>[0.9987, 0.9771, 0.9274, 0.8287, 0.8622, 0.869...</td>\n","      <td>[[0.412426233291626, -0.5254504680633545, 0.11...</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-10f256f7-8ea0-47a6-be56-d6f8613da9eb')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-10f256f7-8ea0-47a6-be56-d6f8613da9eb button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-10f256f7-8ea0-47a6-be56-d6f8613da9eb');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":5}]},{"cell_type":"markdown","metadata":{"id":"cqcWjENGooDw"},"source":["#### [Recognize Entities OntoNotes - BERT Medium](https://nlp.johnsnowlabs.com/2020/12/09/onto_recognize_entities_bert_medium_en.html)\n"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":194},"id":"3QoLlBL2ob1-","outputId":"990c1fc6-9771-44d3-81f1-8b9cf3074557","executionInfo":{"status":"ok","timestamp":1650025587070,"user_tz":-300,"elapsed":19459,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.bert.medium\").predict(\"Johnson first entered politics when elected in 2001 as a member of Parliament. He then served eight years as the mayor of London, from 2008 to 2016, before rejoining Parliament.\",output_level=\"document\")"],"execution_count":6,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_recognize_entities_bert_medium download started this may take some time.\n","Approx size to download 164.2 MB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  Johnson first entered politics when elected in...   \n","\n","                                  entities_onto_bert  \\\n","0  [Johnson, first, 2001, eight years, London,, 2...   \n","\n","                   entities_onto_bert_class  \\\n","0  [PERSON, ORDINAL, DATE, DATE, GPE, DATE]   \n","\n","                       entities_onto_bert_confidence  \\\n","0  [0.9978, 0.8978, 0.7698, 0.6512, 0.7841, 0.714...   \n","\n","                                 word_embedding_onto  \n","0  [[1.1754101514816284, -0.01641417108476162, 0....  "],"text/html":["\n","  <div id=\"df-c71e97b4-01b1-4952-96aa-e1d616c9ef61\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto_bert</th>\n","      <th>entities_onto_bert_class</th>\n","      <th>entities_onto_bert_confidence</th>\n","      <th>word_embedding_onto</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Johnson first entered politics when elected in...</td>\n","      <td>[Johnson, first, 2001, eight years, London,, 2...</td>\n","      <td>[PERSON, ORDINAL, DATE, DATE, GPE, DATE]</td>\n","      <td>[0.9978, 0.8978, 0.7698, 0.6512, 0.7841, 0.714...</td>\n","      <td>[[1.1754101514816284, -0.01641417108476162, 0....</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-c71e97b4-01b1-4952-96aa-e1d616c9ef61')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-c71e97b4-01b1-4952-96aa-e1d616c9ef61 button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-c71e97b4-01b1-4952-96aa-e1d616c9ef61');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":6}]},{"cell_type":"markdown","metadata":{"id":"jWI_LhEuorIj"},"source":["#### [Recognize Entities OntoNotes - BERT Base](https://nlp.johnsnowlabs.com/2020/12/09/onto_recognize_entities_bert_base_en.html)"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":194},"id":"soqCoACKonN4","outputId":"662bc475-d542-415c-8a3e-81c43a81fa90","executionInfo":{"status":"ok","timestamp":1650025720430,"user_tz":-300,"elapsed":62359,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.bert.base\").predict(\"Johnson first entered politics when elected in 2001 as a member of Parliament. He then served eight years as the mayor of London, from 2008 to 2016, before rejoining Parliament.\",output_level=\"document\")"],"execution_count":1,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_recognize_entities_bert_base download started this may take some time.\n","Approx size to download 405 MB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  Johnson first entered politics when elected in...   \n","\n","                                  entities_onto_bert  \\\n","0  [Johnson, first, 2001, Parliament., eight year...   \n","\n","                            entities_onto_bert_class  \\\n","0  [PERSON, ORDINAL, DATE, ORG, DATE, GPE, DATE, ...   \n","\n","                       entities_onto_bert_confidence  \\\n","0  [0.9992, 0.9111, 0.6222, 0.9559, 0.64705, 0.98...   \n","\n","                                 word_embedding_onto  \n","0  [[-0.3947710394859314, 0.10021164268255234, -0...  "],"text/html":["\n","  <div id=\"df-58548008-e005-4df0-8479-54b808553c85\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto_bert</th>\n","      <th>entities_onto_bert_class</th>\n","      <th>entities_onto_bert_confidence</th>\n","      <th>word_embedding_onto</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Johnson first entered politics when elected in...</td>\n","      <td>[Johnson, first, 2001, Parliament., eight year...</td>\n","      <td>[PERSON, ORDINAL, DATE, ORG, DATE, GPE, DATE, ...</td>\n","      <td>[0.9992, 0.9111, 0.6222, 0.9559, 0.64705, 0.98...</td>\n","      <td>[[-0.3947710394859314, 0.10021164268255234, -0...</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-58548008-e005-4df0-8479-54b808553c85')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-58548008-e005-4df0-8479-54b808553c85 button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-58548008-e005-4df0-8479-54b808553c85');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":1}]},{"cell_type":"markdown","metadata":{"id":"mrsiGTULoyui"},"source":["  #### [Recognize Entities OntoNotes - BERT Large](https://nlp.johnsnowlabs.com/2020/12/09/onto_recognize_entities_bert_large_en.html)"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":194},"id":"JOutbicfouYF","outputId":"b21f4941-dc88-4ad7-f344-6f453629744a","executionInfo":{"status":"ok","timestamp":1650025820494,"user_tz":-300,"elapsed":100071,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.bert.large\").predict(\"Johnson first entered politics when elected in 2001 as a member of Parliament. He then served eight years as the mayor of London, from 2008 to 2016, before rejoining Parliament.\",output_level=\"document\")"],"execution_count":2,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_recognize_entities_bert_large download started this may take some time.\n","Approx size to download 1.2 GB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  Johnson first entered politics when elected in...   \n","\n","                                  entities_onto_bert  \\\n","0  [Johnson, first, 2001, Parliament., eight year...   \n","\n","                            entities_onto_bert_class  \\\n","0  [PERSON, ORDINAL, DATE, ORG, DATE, GPE, DATE, ...   \n","\n","                       entities_onto_bert_confidence  \\\n","0  [0.9961, 0.866, 0.9446, 0.707, 0.90925, 0.9309...   \n","\n","                                 word_embedding_onto  \n","0  [[-0.5602331161499023, -0.6613761782646179, 0....  "],"text/html":["\n","  <div id=\"df-5bd60b6a-8a4b-4378-9850-60910ac41cff\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto_bert</th>\n","      <th>entities_onto_bert_class</th>\n","      <th>entities_onto_bert_confidence</th>\n","      <th>word_embedding_onto</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Johnson first entered politics when elected in...</td>\n","      <td>[Johnson, first, 2001, Parliament., eight year...</td>\n","      <td>[PERSON, ORDINAL, DATE, ORG, DATE, GPE, DATE, ...</td>\n","      <td>[0.9961, 0.866, 0.9446, 0.707, 0.90925, 0.9309...</td>\n","      <td>[[-0.5602331161499023, -0.6613761782646179, 0....</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-5bd60b6a-8a4b-4378-9850-60910ac41cff')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-5bd60b6a-8a4b-4378-9850-60910ac41cff button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-5bd60b6a-8a4b-4378-9850-60910ac41cff');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":2}]},{"cell_type":"markdown","metadata":{"id":"eQgAjiW1pKgF"},"source":["#### [Recognize Entities OntoNotes - ELECTRA Small](https://nlp.johnsnowlabs.com/2020/12/09/onto_recognize_entities_electra_small_en.html)"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":194},"id":"6Qy78RBzpGKg","outputId":"448d5424-e4a4-414b-91e2-53ed95b64349","executionInfo":{"status":"ok","timestamp":1650025840475,"user_tz":-300,"elapsed":20113,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.electra.small\").predict(\"Johnson first entered politics when elected in 2001 as a member of Parliament. He then served eight years as the mayor of London, from 2008 to 2016, before rejoining Parliament.\",output_level=\"document\")"],"execution_count":3,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_recognize_entities_electra_small download started this may take some time.\n","Approx size to download 63.1 MB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  Johnson first entered politics when elected in...   \n","\n","                               entities_onto_electra  \\\n","0  [Johnson, first, 2001, eight years, London,, 2...   \n","\n","                entities_onto_electra_class  \\\n","0  [PERSON, ORDINAL, DATE, DATE, GPE, DATE]   \n","\n","                  entities_onto_electra_confidence  \\\n","0  [0.9975, 0.9576, 0.928, 0.64, 0.52, 0.63416666]   \n","\n","                                 word_embedding_onto  \n","0  [[0.6312033534049988, -0.2909033000469208, -0....  "],"text/html":["\n","  <div id=\"df-c695e979-08d8-493a-82a8-130d89508836\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto_electra</th>\n","      <th>entities_onto_electra_class</th>\n","      <th>entities_onto_electra_confidence</th>\n","      <th>word_embedding_onto</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Johnson first entered politics when elected in...</td>\n","      <td>[Johnson, first, 2001, eight years, London,, 2...</td>\n","      <td>[PERSON, ORDINAL, DATE, DATE, GPE, DATE]</td>\n","      <td>[0.9975, 0.9576, 0.928, 0.64, 0.52, 0.63416666]</td>\n","      <td>[[0.6312033534049988, -0.2909033000469208, -0....</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-c695e979-08d8-493a-82a8-130d89508836')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-c695e979-08d8-493a-82a8-130d89508836 button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-c695e979-08d8-493a-82a8-130d89508836');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":3}]},{"cell_type":"markdown","metadata":{"id":"zlUKIvIhplze"},"source":["#### [Recognize Entities OntoNotes - ELECTRA Base](https://nlp.johnsnowlabs.com/2020/12/09/onto_recognize_entities_electra_base_en.html)"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":194},"id":"v7eMjrxzpSfa","outputId":"efc43ac4-5def-49a8-fe54-4d0fae6ad4d8","executionInfo":{"status":"ok","timestamp":1650025885328,"user_tz":-300,"elapsed":45000,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.electra.base\").predict(\"Johnson first entered politics when elected in 2001 as a member of Parliament. He then served eight years as the mayor of London, from 2008 to 2016, before rejoining Parliament.\",output_level=\"document\")"],"execution_count":4,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_recognize_entities_electra_base download started this may take some time.\n","Approx size to download 405 MB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  Johnson first entered politics when elected in...   \n","\n","                               entities_onto_electra  \\\n","0  [Johnson, first, 2001, eight years, London,, 2...   \n","\n","                      entities_onto_electra_class  \\\n","0  [PERSON, ORDINAL, DATE, DATE, GPE, DATE, DATE]   \n","\n","                    entities_onto_electra_confidence  \\\n","0  [0.9989, 0.9192, 0.8709, 0.7794, 0.7311, 0.497...   \n","\n","                                 word_embedding_onto  \n","0  [[0.16227193176746368, 0.18521958589553833, -0...  "],"text/html":["\n","  <div id=\"df-21c4d1f8-039d-47c2-a250-ebb545a15ffa\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto_electra</th>\n","      <th>entities_onto_electra_class</th>\n","      <th>entities_onto_electra_confidence</th>\n","      <th>word_embedding_onto</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Johnson first entered politics when elected in...</td>\n","      <td>[Johnson, first, 2001, eight years, London,, 2...</td>\n","      <td>[PERSON, ORDINAL, DATE, DATE, GPE, DATE, DATE]</td>\n","      <td>[0.9989, 0.9192, 0.8709, 0.7794, 0.7311, 0.497...</td>\n","      <td>[[0.16227193176746368, 0.18521958589553833, -0...</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-21c4d1f8-039d-47c2-a250-ebb545a15ffa')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-21c4d1f8-039d-47c2-a250-ebb545a15ffa button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-21c4d1f8-039d-47c2-a250-ebb545a15ffa');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":4}]},{"cell_type":"markdown","metadata":{"id":"jvkooLaypuyV"},"source":["#### [Recognize Entities OntoNotes - ELECTRA Large](https://nlp.johnsnowlabs.com/2020/12/09/onto_recognize_entities_electra_large_en.html)\n"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/","height":194},"id":"-GeevpxGpsr9","outputId":"2f4b8db7-1aed-4e38-d32e-d4661acc9bb6","executionInfo":{"status":"ok","timestamp":1650026095462,"user_tz":-300,"elapsed":93803,"user":{"displayName":"ahmed lone","userId":"02458088882398909889"}}},"source":["nlu.load(\"en.ner.onto.large\").predict(\"Johnson first entered politics when elected in 2001 as a member of Parliament. He then served eight years as the mayor of London, from 2008 to 2016, before rejoining Parliament.\",output_level=\"document\")"],"execution_count":1,"outputs":[{"output_type":"stream","name":"stdout","text":["onto_recognize_entities_electra_large download started this may take some time.\n","Approx size to download 1.2 GB\n","[OK!]\n"]},{"output_type":"execute_result","data":{"text/plain":["                                            document  \\\n","0  Johnson first entered politics when elected in...   \n","\n","                                 entities_onto_large  \\\n","0  [Johnson, first, 2001, Parliament., eight year...   \n","\n","                       entities_onto_large_class  \\\n","0  [PERSON, ORDINAL, DATE, ORG, DATE, GPE, DATE]   \n","\n","                      entities_onto_large_confidence  \\\n","0  [0.9994, 0.9487, 0.8283, 0.5671, 0.61615, 0.64...   \n","\n","                                 word_embedding_onto  \n","0  [[0.27622202038764954, 0.16563484072685242, 0....  "],"text/html":["\n","  <div id=\"df-452a09ef-cca7-485f-9239-9c9d170aa4c4\">\n","    <div class=\"colab-df-container\">\n","      <div>\n","<style scoped>\n","    .dataframe tbody tr th:only-of-type {\n","        vertical-align: middle;\n","    }\n","\n","    .dataframe tbody tr th {\n","        vertical-align: top;\n","    }\n","\n","    .dataframe thead th {\n","        text-align: right;\n","    }\n","</style>\n","<table border=\"1\" class=\"dataframe\">\n","  <thead>\n","    <tr style=\"text-align: right;\">\n","      <th></th>\n","      <th>document</th>\n","      <th>entities_onto_large</th>\n","      <th>entities_onto_large_class</th>\n","      <th>entities_onto_large_confidence</th>\n","      <th>word_embedding_onto</th>\n","    </tr>\n","  </thead>\n","  <tbody>\n","    <tr>\n","      <th>0</th>\n","      <td>Johnson first entered politics when elected in...</td>\n","      <td>[Johnson, first, 2001, Parliament., eight year...</td>\n","      <td>[PERSON, ORDINAL, DATE, ORG, DATE, GPE, DATE]</td>\n","      <td>[0.9994, 0.9487, 0.8283, 0.5671, 0.61615, 0.64...</td>\n","      <td>[[0.27622202038764954, 0.16563484072685242, 0....</td>\n","    </tr>\n","  </tbody>\n","</table>\n","</div>\n","      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-452a09ef-cca7-485f-9239-9c9d170aa4c4')\"\n","              title=\"Convert this dataframe to an interactive table.\"\n","              style=\"display:none;\">\n","        \n","  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n","       width=\"24px\">\n","    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n","    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n","  </svg>\n","      </button>\n","      \n","  <style>\n","    .colab-df-container {\n","      display:flex;\n","      flex-wrap:wrap;\n","      gap: 12px;\n","    }\n","\n","    .colab-df-convert {\n","      background-color: #E8F0FE;\n","      border: none;\n","      border-radius: 50%;\n","      cursor: pointer;\n","      display: none;\n","      fill: #1967D2;\n","      height: 32px;\n","      padding: 0 0 0 0;\n","      width: 32px;\n","    }\n","\n","    .colab-df-convert:hover {\n","      background-color: #E2EBFA;\n","      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n","      fill: #174EA6;\n","    }\n","\n","    [theme=dark] .colab-df-convert {\n","      background-color: #3B4455;\n","      fill: #D2E3FC;\n","    }\n","\n","    [theme=dark] .colab-df-convert:hover {\n","      background-color: #434B5C;\n","      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n","      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n","      fill: #FFFFFF;\n","    }\n","  </style>\n","\n","      <script>\n","        const buttonEl =\n","          document.querySelector('#df-452a09ef-cca7-485f-9239-9c9d170aa4c4 button.colab-df-convert');\n","        buttonEl.style.display =\n","          google.colab.kernel.accessAllowed ? 'block' : 'none';\n","\n","        async function convertToInteractive(key) {\n","          const element = document.querySelector('#df-452a09ef-cca7-485f-9239-9c9d170aa4c4');\n","          const dataTable =\n","            await google.colab.kernel.invokeFunction('convertToInteractive',\n","                                                     [key], {});\n","          if (!dataTable) return;\n","\n","          const docLinkHtml = 'Like what you see? Visit the ' +\n","            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n","            + ' to learn more about interactive tables.';\n","          element.innerHTML = '';\n","          dataTable['output_type'] = 'display_data';\n","          await google.colab.output.renderOutput(dataTable, element);\n","          const docLink = document.createElement('div');\n","          docLink.innerHTML = docLinkHtml;\n","          element.appendChild(docLink);\n","        }\n","      </script>\n","    </div>\n","  </div>\n","  "]},"metadata":{},"execution_count":1}]},{"cell_type":"code","source":[""],"metadata":{"id":"Y8ZFxpW9NqHn"},"execution_count":null,"outputs":[]}]}